package com.leyou.item.mapper;

import com.leyou.order.pojo.Brand;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * lcd  2020/6/4
 * Description:
 */
public interface BrandMapper extends Mapper<Brand> {
    @Insert("insert into tb_category_brand (category_id,brand_id) values (#{cid},#{bid})")
    Integer insertMiddleBrandCategory(@Param("bid") Long bid,@Param("cid") Long cid);

    @Select("select b.* from tb_brand b join tb_category_brand cb on b.id=cb.brand_id where cb.category_id=#{cid}")
    List<Brand> queryBrandsByCid(@Param("cid") Long cid);
}
